package cn.scxy.bookcity.service.impl;

import cn.scxy.bookcity.ex.ServiceException;
import cn.scxy.bookcity.mapper.ImgsMapper;
import cn.scxy.bookcity.pojo.vo.ImgsListItemVO;
import cn.scxy.bookcity.service.IImgsService;
import cn.scxy.bookcity.web.ServiceCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@Slf4j
public class ImgsServiceImpl implements IImgsService {

    @Autowired
    private ImgsMapper imgsMapper;


    @Override
    public List<ImgsListItemVO> selectListByGid(Long id) {
        List<ImgsListItemVO> imgsListItemVOS = imgsMapper.selectListByGid(id);
        if (imgsListItemVOS==null){
            String message = "查询失败,查询的商品的图片不存在!";
            log.debug(message);
            throw new ServiceException(ServiceCode.ERR_NOT_FOUND, message);
        }
        return imgsListItemVOS;
    }
}
